import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
import "font-awesome/css/font-awesome.min.css";
import { message } from "@/utils/message";
import { notify } from "@/utils/notify";

import "font-awesome/css/font-awesome.min.css";

import "./assets/css/admin.css";

import {
  getRequest,
  postRequest,
  deleteRequest,
  putRequest,
} from "./utils/request";

Vue.use(ElementUI);

Vue.prototype.$message = message;
Vue.prototype.$notify = notify;

//用组件的形式引入到 main.js 主函数中，就可以在Vue的其他组件全局调用请求接口获取返回数据
Vue.prototype.postRequest = postRequest;
Vue.prototype.getRequest = getRequest;
Vue.prototype.putRequest = putRequest;
Vue.prototype.deleteRequest = deleteRequest;

Vue.config.productionTip = false;

/*
// 路由守卫
router.beforeEach((to, from, next) => {
  if (to.name == "login") {
    //访问登录页面 正常访问
    next();
  } else {
    if (window.localStorage.getItem("token")) {
      if (window.localStorage.getItem("userInfo")) {
        //访问其他页面，没有token和userinfo，跳转到登录页面
        next();
      }
    } else {
      ElementUI.Message.info("请先登录");
      next("/login");
    }
  }
});
*/
new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount("#app");
